import { BasicColumn } from '/@/components/Table/src/types/table';
import { FormSchema } from '/@/components/Table';
import dayjs from 'dayjs';
// import dayjs from 'dayjs';

export function getBasicColumns(): BasicColumn[] {
  return [
    {
      title: '审批单号',
      dataIndex: 'examineApproveCode',
      width: 160,
    },
    {
      title: '单位编号',
      dataIndex: 'unitId',
      width: 80,
      customRender({ record }) {
        return record.examineApprove.unitId;
      },
    },
    {
      title: '部门编号',
      dataIndex: 'departmentId',
      width: 80,
      customRender({ record }) {
        return record.examineApprove.departmentId;
      },
    },
    {
      title: '职工编号',
      dataIndex: 'employeeNo',
      width: 80,
      customRender({ record }) {
        return record.examineApprove.employeeNo;
      },
    },
    {
      title: '职工姓名',
      dataIndex: 'employeeName',
      width: 85,
      customRender({ record }) {
        return record.examineApprove.employeeName;
      },
    },
    {
      title: '目的地',
      dataIndex: 'destination',
      width: 80,
      customRender({ record }) {
        return record.examineApprove.destination;
      },
    },
    {
      title: '出发日期',
      dataIndex: 'dateOfDeparture',
      width: 110,
      customRender({ record }) {
        return record.examineApprove.dateOfDeparture
          ? dayjs(record.examineApprove.dateOfDeparture).format('YYYY/MM/DD')
          : '-';
      },
    },
    {
      title: '返程日期',
      dataIndex: 'dateOfReturn',
      width: 110,
      customRender({ record }) {
        return record.examineApprove.dateOfReturn
          ? dayjs(record.examineApprove.dateOfReturn).format('YYYY/MM/DD')
          : '-';
      },
    },
    {
      title: '到期日期',
      dataIndex: 'dateOfReturnProlong',
      width: 110,
      customRender({ record }) {
        return record.examineApprove.dateOfReturnProlong
          ? dayjs(record.examineApprove.dateOfReturnProlong).format('YYYY/MM/DD')
          : '-';
      },
    },
    {
      title: '交通工具',
      dataIndex: 'vehicle',
      width: 140,
      customRender({ record }) {
        return record.examineApprove.vehicle;
      },
    },
    {
      title: '用餐天数',
      dataIndex: 'countMeals',
      width: 80,
    },
    {
      title: '伙食费补助',
      dataIndex: 'moneyMeals',
      width: 140,
    },
    {
      title: '用车天数',
      dataIndex: 'countCar',
      width: 80,
    },
    {
      title: '市内交通费补助',
      dataIndex: 'moneyCar',
      width: 140,
    },
    {
      title: '合计金额',
      dataIndex: 'sumMoney',
      width: 80,
      customRender({ record }) {
        return record.moneyCar + record.moneyMeals;
      },
    },
  ];
}
export const searchFormSchema: FormSchema[] = [
  {
    field: 'applyDate',
    component: 'RangePicker',
    label: '出发日期',
    colProps: {
      span: 6,
    },
    componentProps: {
      placeholder: ['出发日期起', '出发日期止'],
      style: 'width: 240px',
    },
  },
  {
    field: 'employeeNo',
    label: '职工编号',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: ' ',
      style: 'width: 220px',
    },
  },
  {
    field: 'employeeName',
    label: '职工姓名',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: ' ',
      style: 'width: 220px',
    },
  },
  {
    field: 'examineApproveCode',
    label: '审批单号',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: ' ',
      style: 'width: 220px',
    },
  },

  // if (record.carCategory === 'COMFORT') return '舒适型';
  //       if (record.carCategory === 'ECONOMIC') return '经济型';
];
